package com.openlogic.logic.adaptor;

import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.handle.UploadedFile;

import com.openlogic.common.plugins.db.api.dto.BaseDataSourceParamDto;
import com.openlogic.datasource.api.enums.DataCategory;
import com.openlogic.logic.service.datasource.DataSourceService;

/**
* @ClassName: RDBDataSourceAdapter
* @Description: 关系型数据库适配器
* @author weiyongpeng
* @date 2024年12月16日 上午9:28:07
 */
@Component
public class RDBDataSourceAdapter implements DataSourceAdapter{
	
	@Inject
	private DataSourceService dataSourceService;

	@Override
	public boolean support(String adapter) {
		return DataCategory.RDB.getKey().equals(adapter);
	}

	@Override
	public void createDataSource(BaseDataSourceParamDto dataSourceParam, UploadedFile file) {
		dataSourceService.createDataSource(dataSourceParam);
	}

	@Override
	public void updateDataSource(String id, BaseDataSourceParamDto dataSourceParam, UploadedFile file) {
		dataSourceService.updateDataSource(id, dataSourceParam);
	}

}
